local Director <const> = require("Director")
local Content <const> = require("Content")
local Path <const> = require("Path")
local DB <const> = require("DB")
local Config <const> = require("Config")

local dbPath = Path(Content.writablePath, "story.db")
DB:exec("ATTACH DATABASE '" .. dbPath .. "' AS story;")
Director.entry:onCleanup(function()
	DB:exec("DETACH DATABASE story")
end)

local conf = Config(
"story",
"charName",
"chapter",

"gold",
"name",
"san",
"spirit",
"playchoice",
"visited_slide",
"visited_swing",
"visited_pool",
"fun_picture",
"talknpc1",
"paper1",
"rule1",
"step1",
"talknpc2",
"paper2",
"rule2",
"step2",
"day",
"livingroom2",
"wall2",
"vast2",
"chair2",
"explore1",
"visited_amusementpark1",
"visited_library1",
"visited_dinninghall1",
"rest",
"eat2",
"explore2",
"visited_amusementpark2",
"visited_library2",
"visited_dinninghall2",
"playchoice2",
"visited_slide2",
"visited_swing2",
"visited_pool2",
"explore3",
"visited_amusementpark3",
"visited_library3",
"visited_dinninghall3",
"playchoice3",
"visited_slide3",
"visited_swing3",
"visited_pool3",
"eat3",
"talk4npc1",
"talk4npc2",
"seeparent3",
"talk4npc3",
"thatroom3",
"where3",
"past3",
"talk4npc11",
"talk4npc22",
"talk4npc33",
"eat4",
"visited_amusementpark4",
"visited_library4",
"visited_dinninghall4",
"playchoice4",
"visited_slide4",
"visited_swing4",
"visited_pool4",
"explore4",
"papercut",
"talk5npc11",
"talk5npc22",
"talk5npc33",
"eat5",
"explore5",
"visited_amusementpark5",
"visited_library5",
"visited_dinninghall5",
"playchoice5",
"visited_slide5",
"visited_swing5",
"visited_pool5",
"papermvp",
"notebook")

conf:load()

if not conf.chapter then
	conf.chapter = "start"
end

return conf